<?php session_start(); ?>
<?php
 if(!$_SESSION['uname']){
  echo "你没有权限访问此页面!";
  return false;
}
?>
<?php include("../inc/db_config.inc"); ?>
<?php
if(isset($_REQUEST['realname'])&&$_REQUEST['realname']!=""){
    $p_realname=$_REQUEST['realname'];
}else{
    echo "昵称不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['sex'])&&$_REQUEST['sex']!=""){
    $p_sex=$_REQUEST['sex'];
}else{
    echo "性别不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['birth'])&&$_REQUEST['birth']!=""){
    $p_birth=$_REQUEST['birth'];
}else{
    echo "出生日期不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['email'])&&$_REQUEST['email']!=""){
    $p_email=$_REQUEST['email'];
}else{
    echo "email不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['tel'])&&$_REQUEST['tel']!=""){
    $p_tel=$_REQUEST['tel'];
}else{
    echo "电话号码不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['address'])&&$_REQUEST['address']!=""){
    $p_address=$_REQUEST['address'];
}else{
    echo "地址不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
$p_qq=$_REQUEST['qq'];
/*
if(isset($qq)&&$qq!=""){
    $p_qq=$qq;
}else{
    echo "qq号码不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}*/

date_default_timezone_set("Asia/Shanghai"); //北京时间
$notice_created=date("Y-m-d H:i:s");
$notice_puber=1;
//echo "insert into type (name,cataDesc,created,status) values('$cata_title','$cata_desc','$cata_created','$cata_status')";
$result_post=mysql_query("update user set realname='$p_realname',sex='$p_sex',birth='$p_birth',email='$p_email',tel='$p_tel',address='$p_address',qq='$p_qq' where id=1");
if(mysql_affected_rows()>0){
    echo "更新成功!页面会在1秒钟后自动返回.<script type='text/javascript'>setTimeout(function(){history.back()},1000)</script>";
}else{
    echo "更新失败!<a href='javascript:history.back()'>返回</a>";
}
 ?>